import Axios from "../../lib/request";

export const login = function(data) {
	return Axios.post("/login", data);
};
export const modifyPassWord = function(data,data1,data2) {
	return Axios.post(`/user/password/update?oldPassword=${data}&newPassword=${data1}&username=${data2}`);
};
export const passwordReset = function(data) {
	return Axios.post(`/user/password/reset/${data}`);
};
// 查询用户列表  不做分页
export const getUserList = function(data) {
	let param = {
		user: { username: "" },
		queryRequest: {
			pageSize: data.pageSize,
			pageNum: data.pageNum
		}
	};

	return Axios.post("/user/list", param);
	// return Axios.get("/user/list?pageSize=" + data.pageSize + "&pageNum=" + data.pageNum);
};
//添加用户信息
export const userAdd = function(data) {
	return Axios.post("/user", data);
};
//删除用户信息
export const userDelete = function(id) {
	return Axios.get(`/user/delete/${id}`);
};
//修改用户信息
export const userUpdate = function(data) {
	return Axios.post(`/user/update`, data);
};
//获取菜单权限
export const getmenu = function(name) {
	// return Axios.get(`/menu/${name}`);
	return Axios.get(`/menu/tree`);
};

export const getCurrentMenu = function(username) {
	return Axios.get(`/menu/${username}`);
};
//获取所有角色
export const getRoleList = function() {
	return Axios.get(`/role`);
};
//用户详情
export const getUserDetail = function(name) {
	return Axios.get(`/user/${name}`);
};

export const deleteMenu = function(ids) {
	return Axios.get(`/menu/delete/${ids}`, {});
};
